package co.yixiang.modules.system.repository;

import co.yixiang.modules.system.domain.YxSalesManage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
* @author frq
* @date 2020-05-25
*/
public interface YxSalesManageRepository extends JpaRepository<YxSalesManage, Integer>, JpaSpecificationExecutor<YxSalesManage> {
    @Modifying
    @Query(value = "delete from yx_sales_manage where manage_uid=?1",nativeQuery = true)
    void deleteManageUid(Integer manageUid);
    @Query(value = "select yxm.uid  from yx_sales_manage yxm inner join yx_sales yx on yx.uid=yxm.manage_uid where manage_uid=?1",nativeQuery = true)
    List<Integer> findByManageUid(Integer manageUid);
    @Modifying
    @Query(value = "delete from yx_sales_manage where manage_uid=?1 or uid=?1",nativeQuery = true)
    void deleteManageId(Integer id);
}